Blassic – Classic BASIC

On Win32 and Linux

Reference Documentation

for v0.10.0.(0.11.0 (Pre))   

Blassic by Julian Albo


April 2006 document update for Blassic .0.11.0 (Pre)    by Julian Albo

 

Doc’s edited and updated by K. Sheldon – kfasheldon@hotmail.com

 

Any further command syntax known please email me and I will endeavor update this document.

Short examples for complex commands welcome.

 

Also Hints and tips would be useful as I am sure there are quirks and idiosyncrasies with this Basic that we could all share.

 

Adapted from (in part)
reference Document for Blassic v0.5.x by Julian Albo (ninsesabe@arrakis.es)

Update by Andrew L. Ayers (andrewa at phoenixgarage.NOSPAM.org) on January 27, 2003  

 

Please note that Blassic is constantly being updated and revised, and that some of the definitions for the keywords used in Blassic may not be completely valid.

 

I have tried my best to create useful documentation for Blassic, I can only hope that the community for Blassic continues to update and improve this documentation in the future.

 

 



       Contents

Some notes about Blassic. 4

Line numbers or not line numbers?. 4

Execute a program by giving only its name. 4

Svgalib support. 5

Compiled Blassic programs. 5

Can I create windows?. 5

Feedback. 5

Blassic: Language Notes. 6

String Slicing. 6

Data Types. 6

Maths operators. 7

Conversion Operators. 7

Blassic. Command line options. 8

Blassic Keywords. 10

Blassic Character Sets. 50

Spectrum Predefined Block Graphics Codes. 50


PreDefined Color Pallete. 50

Blassic: System variables. 52

Blassic Error Codes. 55

     Blassic printing guide. 57

Printer output. 57

Line Width and line separator. 57

LPRINT and LLIST instructions. 57

Last page is not printed. 57

Postscript printers. 58

ASCII Character Sets............................................................................     To be completed. 58

WINDOWS TEXT CONSOLE , HEX. 58

ALL Reserved Words. 59

 


 

Further reading;

Amstrad CPC Basic Reference

Sinclair Spectrum Basic Reference

GW Basic, QBasic and Microsoft Basic reference guides.

Much information can be found on the net with ease.

 


Some notes about Blassic.

Last modified: 14-feb-2005.

 

Line numbers or not line numbers?

 

You can be confused by the fact that the presentation of Blassic says "line numbers are mandatory" but many of the sample programs have no line numbers at all. The answer is simple, Blassic always use line numbers, but when a program is loaded in text format the numbers are auto generated if not present. That way using LABEL as target of GOTOs and GOSUBs you can effectively write a program without worrying about the line numbers, but they are here if your program need them.

If you want to strip the line numbers of a program you can save it in binary form and use the sample program list.bas with the -n option, like this: blassic list -n program.blc > newprogram.bas. NB.Line 0 is valid.

 

Execute a program by giving only its name.

 

In Unix versions you can write programs that execute as normal commands, without using "blassic program". You only need to put in the first line "# !/usr/bin/blassic" and give it execute permission. When loading the program Blassic ignores the first line if begins with an "#", so you can use this unix usual method.

 

Execute a program by clicking on it in Windows.

 

The following registry keys can be added:

[HKEY_CLASSES_ROOT\.bas]

@="blassicfile"

[HKEY_CLASSES_ROOT\.blc]

@="blassicfile"

[HKEY_CLASSES_ROOT\blassicfile]

[HKEY_CLASSES_ROOT\blassicfile\shell]

[HKEY_CLASSES_ROOT\blassicfile\shell\open]

[HKEY_CLASSES_ROOT\blassicfile\shell\open\command]

@="blassic \"%1\""

 

You can do it automatically by clicking on this link: blassic.reg and selecting execute, or downloading the file and executing it.

 

To execute graphics programs avoiding that a text window stay opened you can add the -d option to the command value, o create another entry associated with others file extensions (I suggest .basw and .blcw).

 

This assumes that you have blassic.exe in some directory included in the PATH, if not you must put the complete path in the command entry. Depending on the windows version and how is configured, it can be necessary to put the entire path even in that case.

 

Svgalib support.

 

Svgalib was supported in the first versions of Blassic. I do not have it installed since long time, and thus stopped supporting it. However I do not delete the related options in configure nor the code already written, in the hope that something interested will eventually take care of it.

 

Compiled Blassic programs.

 

No, there is no compiler for Blassic. Maybe someday...

 

Can I create windows?

 

No, the graphics modes create a unique window.

 

The WINDOW instruction define text frames into this window that can be used to print into different channels.  Taken from the Amstrad CPC Basic.

 

NOTE:Graphics windows in V0.110 to be documented.

Feedback.

 

Mailing list: http://groups.yahoo.com/group/blassic/

e-mail: julian.notfound@gmail.com




Blassic: Language Notes

Blassic makes use of a variety of variable types. Each type has an associated character suffix, which may be added to the end of the variable to help identify what the variable represents.

 

String Slicing

 

String slicing can be carried out using Sinclair syntax as well as the normal referencing using LEFT$, RIGHT$ and MID$.

 

Syntax            A$ [ a TO b]

 

Where a is the start point and b is the end point.

Note use of [] brackets not () as in Sinclair Basic as () would cause confusion with arrays, a simple change to update any Spectrum programs.

 

A$=”1234567890”

PRINT A$[5 TO 7]

 

Output:           567

 

The last number (b) may be omitted, if so all output to end of string is returned. 

Note: unlike Sinclair Basic the first number must exist or you will get a Syntax Horror.


Data Types

 

string                           $                      integer                         %

long-integer                 &                     single-precision           !

double-precision         ?                      floating point              #

In Blassic, TRUE is defined to be "-1", whereas FALSE is defined to be "0".

Can be altered with system variables to TRUE = 1

 

The graphics system is not initialized until a graphics mode is established. Under X the X server can be established or changed on the fly by changing the value of the DISPLAY environment variable.

Blassic's only size limitations are available memory and hard disk space. Other than that, "the sky is the limit"!

 


Maths operators

 

+          plus                                                                 -           minus

/          division                                                           *          multiply

\          integer division                                             <>       not equal

.>         Greater than                                                  <          less than

=          equal too                                                        => ,  <= , ><, >=, => are OK

^          power off

 

Other reserved operators symbols

 

\\  , [  , ] , ( , ) , #

 

Conversion Operators

 

VAL(“&xbinary”)                   Binary Conversion                (equiv BIN 11111111)

Usage:

PRINT VAL( “&x11111111”) 

Output:                       255 



Blassic. Command line options.

Last modified: 13-feb-2005.

 

"In case it wasn't clear, options are usually optional."

(The tao of option parsing, in Optik documentation).

 

-a n1[,n2]

Auto number values. n1 is the first line number to be used, n2 the increment. Establishes the values for the system vars AutoInit and AutoInc.

 

--allflags

Set all compatibility flags to 1. Useful only for testing.

 

--appleII

Adjust several system vars to Apple II Basic compatibility.

 

--cpc

Adjust several system vars to Amstrad CPC Basic compatibility.

 

--comblank

Sets wether to convert blank lines to comment lines when loading a text program.

 

-d

Detach from console.  (caution causes mode 0 to abruptly exit on windows BUG)

 

--debug level

Set the debug level to level, the value is asigned to the DebugLevel system var and is used by the IF_DEBUG instruction.

 

-e command

Execute command and exit. Must be the last option. You must take care with the quoting conventions of your shell.
Example in unix whith sh: blassic -e 'print "Hola" '

 

--errout

Redirect the error output to the standard output.

 

--gwbasic

Adjust several system vars to GW Basic compatibility.

 

--info

Show additional info in some error conditions.

 

--lfcr

Convert line feed to carriage return in INKEY$ and GET in text mode in unix.

 

-m mode_number | mode_name | widthxheight

Mode. Executes MODE mode_number or MODE "mode_name"

(Note: - width,height  does not appear to work on windows untested on *nix)

 

-norun

If a program is specified as argument, load it but not run.

 

-p list of expressions

Print each of the expressions with the PRINT instruction.

 

-rotate

Rotate 90 degrees all graphics modes. Useful on PDAs. Arrow keys are also rotated.

 

--spectrum

Adjust several system vars to Spectrum Basic compatibility.

 

--tron

Enter tron mode. Same effect as the TRON instruction without arguments.

 

--tronline

Entre tron line mode. Same effect as the TRON LINE instruction without arguments.

-x keyword

Exclude keyword from the list of Blassic keywords. Useful to execute a program that uses a Blassic keyword as variable name. Can be specified several times to exclude more keywords.

- -

Inside of a list of expressions for the -p option marks the end of the list. In other case, marks the end of options.

-

Used as program name means read the program form standard input.

 

 



Blassic Keywords

Please note:
Keywords preceeded by an asterisk (*) are undocumented at this time, either because the keyword is a part of another version of Blassic, or the keyword is not yet implemented, or the function of the keyword is not known or clear to the author of this document.

Blassic utilizes three distinct types of keywords: Commands, Functions, and Statements. Commands are those keywords which are typically used only in the Blassic editor/debugger (ie, when Blassic is not started with a filename). Functions are those keywords which may or may not take arguments, but which always return a value to the Blassic program. Statements are keywords which are used to execute a specified action within Blassic, and may or may not take arguments, but do not return a value back to the Blassic program.

 



A b c d e f g h i j k l m n o p q r s t u v w x y z

 

ABS (n)

Function. Returns the absolute value of the number "n".
PRINT ABS (-1)

 

ACOS (n)

Function. Returns the arc-cosine value of the number "n".
PRINT ACOS (.01)

 

ACOSH(n)

Function. Returns the hyperbolic arc cosine of the parameter.

AFTER

See SYMBOL AFTER.

 

ALLOC_MEMORY

Function: ALLOC_MEMORY ( n )

Allocates a block of memory of size n and return his address. The block of memory is readable, writable and executable if the operating system allows it. See the sample program machinecode.bas for an example of use.


 

AND

Logical Operation. Returns the bitwise-AND value computed between two numbers.
A = 5 AND 3: PRINT A

 

APPEND

See OPEN.

 

AS

See OPEN, SOCKET, FIELD and NAME.

 

ASC (char$)

Function. Returns the ascii value of the character "char$".
A$ = "A": PRINT ASC (A$)

 

ASIN (n)

Function. Returns the arc-sine value of the number "n".
PRINT ASIN (.01)

 

ASINH (n)

Function. Returns the hyperbolic arc sine of the parameter.

 

AT

PRINT modifier.

PRINT ... AT y, x

... Place the cursor in the x column of the line y. Contrary to the other cursor movement instructions, the upper left of the screen is 0, 0.

 

ATAN (n)

Function. Returns the arc-tangent value of the number "n".
PRINT ATAN (.01)

 

ATAN2 (x,y)

Function. ATAN (y, x) returns the arc between the x axis and the line (0, 0) - (x,y).

 

ATANH (n)

Function. Returns the hyperbolic arc tangent of the argument.

 


AUTO [n] [, i]

Command. Enters the auto numbering mode. "n" is the initial number to start at, and "i" is the increment. The default values are set as 10 and 10.
AUTO 10, 5.

 

a B c d e f g h i j k l m n o p q r s t u v w x y z

 

BEEP

Makes a beep.

 

BIN$ (n)

Function. Returns the binary value as a string, of the number "n".
BV$ = BIN$ (24): PRINT "The binary value of 24 is ";BV$

BINARY

Mode specification for OPEN

 

BORDER n                                                                                                 (v0.11.0)

Sets border color for graphic windows

 

BORDER WIDTH n                                                                                 (v0.11.0)

Set width of graphics border

 

BREAK

See ON BREAK.

 

BRIGHT n

Print modifier, like spectrum but for ink only.  n=1 or 0 on/off

PRINT BRIGHT 1 “HELLO”

BRIGHT 1

 

a b C d e f g h i j k l m n o p q r s t u v w x y z

 

CHAIN program$

Statement. Stops execution of currently running Blassic program, then loads and begins execution of another Blassic program defined as "program$".

Defined variables and values are preserved between the CHAIN.
PROG$ = "program.bas": CHAIN PROG$

 

 

 

 

CHDIR path$

Statement. Changes the current directory for subsequent FILES command usage see FILES) to "path$".


CHDIR ".\temp\"

 

CHR$ (n)

Function. Returns the ascii character as a string, of the number "n".
A = 65: PRINT CHR$ (A)

 

CINT (n)

Function. Returns the integer value of the decimal number "n" (rounded up to the nearest integer).
PRINT CINT (1.5)

 

CIRCLE (x, y), r [,c [,sa, ea]]

CIRCLE x,y,r

Statement. Draws a circle in a graphics mode (see MODE), at the coordinates indicated by "x" and "y", with a radius of "r" pixels, in the current color (see COLOR). If "c" is specified, then the circle is drawn with the color indicated by "c" (see COLOR for table of values). If "sa" and "ea" (start and end angles) are specified, then an arc (part of a circle) is drawn. The angles must indicate a range between 0 and 2π (see PI). Zero angle is at the "3 o'clock" position on the circle (ie, 1,0 on the unit circle), and proceeds counterclockwise around the circle.

Also accepts Spectrum sysntax or x,y, radius.


CIRCLE (160, 100), 50, 4
CIRCLE (160, 100), 50, 4, PI/2, PI

CIRCLE 100,100,50

 

CLEAR

Statement. Clears all variables, including array variables (see DIM and ERASE).
CLEAR

 

CLEAR INK

            Reset ink color ?

 

CLOSE [#channel]

Statement. Closes all open file channels. Passing the optional input/output channel "channel" will close only that open channel number (see OPEN).
CLOSE #1

 

CLS

Statement. Clears the window to the currently selected PAPER color (see PAPER).
PAPER 1: CLS

 

COLOR n,[n2,[n3]]

Statement. Changes the currently selected foreground text color to the color represented by the number "n". All subsequent printed text and graphics will be drawn using this color. n2 will set the paper color used for subsequent text output.

Possible color values are:

 

Number

Description

Number

Description

0

Black

8

Dk Grey

1

Dk Blue

9

Lt Blue

2

Dk Green

10

Lt Green

3

Dk Cyan

11

Lt Cyan

4

Red

12

Lt Red

5

Purple

13

lt Purple

6

Brown

14

Yellow

7

Lt Grey

15

White


COLOR 5: REM Change to purple

 

Optional n3 to set border color for graphic windows.                                                                  (v0.11.0)

 

CONT

CONT. Command. Continue with execution of the code after a CTRL-C break.
CONT

 

COPYCHR$

Function. COPYCHR$ (#w) return the character present at the current cursor position in window w, or the empty string if the character can't be recognized

 

New optional parameters from .0.10.0 not yet documented

 

 

 

COS (n)

Function. Returns the cosine value of the number "n".
PRINT COS (.01)

 

COSH (n)

Function. Returns the hyperbolic cosine value of the argument.

CVD (str$)

Function. Converts a passed in string "str$" to a double-precision number. The passed string must be eight (8) bytes or longer. If less than 8 bytes long, an error is generated. If more than 8 bytes long, only the first 8 bytes are used.
PRINT CVD ("abcdefgh")

 

CVDMBF

As CVD but to floating point format as used on some 8 bit micros.

 

CVI (str$)

Function. Converts a passed in string "str$" to an integer number. The passed string must be two (2) bytes or longer. If less than 2 bytes long, an error is generated. If more than 2 bytes long, only the first 2 bytes are used.
PRINT CVI ("ab")

 

CVL (str$)

Function. Converts a passed in string "str$" to a long-integer number. The passed string must be four (4) bytes or longer. If less than 4 bytes long, an error is generated. If more than 4 bytes long, only the first 4 bytes are used.
PRINT CVL ("abcd")

 

CVS (str$)

Function. Converts a passed in string "str$" to a single-precision number. The passed string must be four (4) bytes or longer. If less than 4 bytes long, an error is generated. If more than 4 bytes long, only the first 4 bytes are used.
PRINT CVS ("abcd")

 

CVSMBF

As above but 8 bit floating point format.

 

a b c D e f g h i j k l m n o p q r s t u v w x y z

 

 

 

DATA n1 [,n2 ,n3, etc]

Statement. Defines a list of constants "n1, n2, n3, etc", of numeric and/or string type, which may be intermixed, to be parsed by a READ statement. Note that the variable type (numeric or string) defined in the READ statement must match with the constant type in the DATA statement (see READ and RESTORE).
DATA 1, "This is number one", 2, "This is number two"

 

DATE$

Function. Returns a string containing the current date in the format "mm-dd-yyyy".
A$ = DATE$: PRINT "Today's date is ";A$

 

DEC$

Function DEC$ ( number, format) Returns a string representing the number using the specified format, that is a format specifier like the used in PRINT USING limited to numeric formats that represent a single number

 

DEF FN functiondef (arguments)

Statement. Defines a named function for later use in the program. Functions may be defined on a single line, or may span multiple lines, ending with the statment FN END (see FN END).
DEF FN concat$ (a$, b$) = a$ + b$: PRINT FN concat$ ("here", "there")
DEF FN addone (x) = x + 1: PRINT FN addone (5)

 

NOTE: At present functions need to be declared before they can be used.

 

DEF [DBL¦INT|REAL¦SNG|STR] list

Statement. Defines a particular variable or range of variables, as defined in "list" as being of integer, real, or string data types. Attempting to set a variables defined as one type to a value of another type will result in an error at runtime.
DEF INT A
DEF INT A-Z
DEF INT A-Z, a-z
DEF REAL L-N
DEF STR A-B, NAME

 

DEFDBL

Same as DEF REAL

DEFINT

Same as DEF INT

DEFREAL

Same as DEF REAL

 

DEFSNG

Same as DEF REAL

DEFSTR

Same as DEF STR

 

DELETE [n1 [- n2]]

Command. If neither "n1" or "n2" are passed, deletes the program currently in memory. If "n1" is a line number, deletes that line. If "n1" and "n2" are both line numbers spanning a range of lines, those lines in the range are deleted.
DELETE 10-50

 

DEG

Set the trigonometric mode to degrees.

 

DELIMITER #channel, char$

Statement. Sets the delimeter to the character "char$", used by the open sequential input/output channel "channel", to separate data fields within each data line parsed.
DELIMITER #1, "-": INPUT #1, A$, B$, C$

 

DIM listvar(n1) [, var(n2), etc]

Statement. Dimensions and allocates memory for an array or list of arrays in "list". Memory allocated may be reclaimed by using CLEAR. The array may also be cleared by using ERASE.
DIM A$(20)
DIM A$(20), B$(5), CC(12)

 

DRAW str$

Statement. Draws the object described by a string "str$" of graphics language commands in the current graphics mode (see MODE). The following table details the graphics command language:

Command

Description

B

Causes the cursor to not DRAW on the next motion command

C n

Changes the current drawing color to value "n" (see
COLOR for table of valid color values for "n")

U n

Moves up "n" pixels from the current position

D n

Moves down "n" pixels from the current position

L n

Moves left "n" pixels from the current position

R n

Moves right "n" pixels from the current position

E n

Moves diagonally up and right "n" pixels from the current position

F n

Moves diagonally down and right "n" pixels from the current position

G n

Moves diagonally down and left "n" pixels from the current position

H n

Moves diagonally up and left "n" pixels from the current position

M x, y

Moves to the coordinate specified by "x" and "y". Motion is
absolute unless "x" and/or "y" are prefixed with either "+" or "-", in which
case the move will be relative to the current position.


DRAW "BM100,100;R20;D20;L20;U20": REM DRAW A SQUARE
DRAW "BM100,100;E20;F20;L40": REM DRAW A TRIANGLE
DRAW "BM100,100;R20;M+10,-20;U20;L40"

 

DRAW x, y[,a][,b]

DRAWR x, y

Statement. Draws a line to the position "x, y" in the current COLOR from a position specified by the MOVE statement (see COLOR and MOVE). DRAWR draws a line relative to the current position.
COLOR 1: MOVE 50,50: DRAW 100,100

Purpose of a,b not known

DRAWARC  x,y,z

Full Syntax unknown

 

a b c d E f g h i j k l m n o p q r s t u v w x y z

 

EDIT n

Command. Edit a line number "n" in the program currently in memory.
EDIT 25

 

END

Statement. Ends the execution of the currently running Blassic program.

Also performs RESTORE
END

 

ELSE

Expression See IF. (As in IF exp THEN statement ELSE statement)

 

ENVIRON var$

Statement. Creates an environment variable for the environment the Blassic program is currently running in, as defined by the variable "var$".
V$ = "TEST=test env variable": ENVIRON V$: SHELL "env | more"

 

ENVIRON$ (var$)

Function. Returns a string containing the value of the requested environment variable "var$".
PATH$ = ENVIRON$ ("PATH"): PRINT "The path is "; PATH$

 

EOF (n)

Function. Returns TRUE (-1) if the end of file has been reached on the current open input/output channel number "n" (see OPEN).
IF EOF (1) THEN CLOSE #1

 

ERASE list

Statement. Clears individual array variables defined in "list" (see DIM and CLEAR).
DIM A(10), TT(5): ERASE A, TT

 

ERL

Function. Returns the program line where the last error was generated. Normally used inside an ON ERROR GOTO routine.
PRINT "Error occurred on line "; ERL

 

ERR

Function. Returns the code of the last error generated. Normally used inside an ON ERROR GOTO routine.
PRINT "Error code "; ERR

 

ERROR n

Statement. Forces the error number "n", stopping the program or jumping to the position established by a previous ON ERROR GOTO statement. For a list of the error numbers used by Blassic, please refer to the error.h file in the Blassic sources.
ERROR 1

 

EXIT [n]

Statement. Quit the currently running program in memory, returning to the operating system. If then number "n" is specified, it will be used as the return value of the Blassic comment, otherwise Blassic will return "0" (the ERRORLEVEL value in Windows).
EXIT 1

 

EXP (n)

Function. Returns the mathematical number e raised to the number "n"th power, where e is the base for natural logarithms (e = ~2.7182818).
PRINT EXP (1): REM RETURN e, WHICH EQUALS ~2.7182818

 

a b c d e F g h i j k l m n o p q r s t u v w x y z

 

FIELD #channel, n1 AS var1$ [, n2 AS var2$...]

Statement. Allocates space and position of variables in a random input/output buffer (see OPEN), where "channel" is the number of the open input/output channel, "n1" is the number of characters allocated to the field, and "var1$" is a string variable that will be used to access the field. FIELD does not actually insert or retrieve any data from the open input/output channel. It only designates how the data will be inserted by the PUT statement, and retrieved by the GET statement.
FIELD #1, 25 AS NAME$, 8 AS DOB$, 3 AS AGE$

 

FIELD APPEND

Not documented yet.

 

FIELD CLEAR

Not documented yet.

 

FILES [ #channel , ] "mask"

List files in current directory that matches mask. The wildcards allowed are operating system dependant. The listing is directed to the channel specified, 0 by default, that can be a window or a file

FILES            [str$]

List files in current directory (see CHDIR).
FILES "*.TXT": REM Return all files ending in ".TXT"

Please note that the wildcards allowed are operating system dependent

 

FIND_FIRST_NOT_OF

Function. As FIND_FIRST_OF but with characters that are not in char$.

 

FIND_FIRST_OF

Funtion. FIND_FIRST_OF (searched$, char$) Returns the first position of searched that contains a character of char$, or 0 if none is found.

 

FIND_LAST_NOT_OF

Function. As FIND_LAST_OF, but with characters thar are not in char$.

 

FIND_LAST_OF

Fuction. As FIND_FIRST_OF but returns the last position.

 

FINDFIRST$

Function. FINDFIRST$ (mask$) Returns the first file that matches wiht mask$ or the empty string if there is no match . The wildcards allowed and his interpertation are operating system dependant.

 

FINDNEXT$

Function whitout parameters. Returns the next file that matches with the mask$ used in the las FINDFISRT$ executed, or the empty string if there is no more matches.

 

FIX (n)

Function. Truncates the decimal portion of the number "n" and returns the whole number part.
PRINT FIX (1.5): REM Prints "1"

 

FN name(args,args…)

Call user defined function passing args.

FN add(1,2)

 

FN RETURN

As FN END

 

FN END

Statement. Terminates the end of a multi-line function declaration (see DEF FN).
DEF FN addtwice (x)
  x = x + 5
  x = x + 10
  addtwice = x
FN END

 

FOR var = n1 TO n2 [STEP i]

Statement. Initializes and executes a loop, which sets the variable "var" to each value in the loop, with a beginning value of "n1" and an ending value of "n2", incremented by the STEP increment value "i". Values "n1", "n2" and "i" may all be negative. STEP is optional and is assumed to be "1" if not specified (see NEXT).
FOR cc = 1 TO 5: PRINT cc: NEXT cc
FOR cc = 1 TO 10 STEP 2: PRINT cc: NEXT cc
FOR cc = 5 TO -5 STEP -1: PRINT cc: NEXT cc

 

FREE_MEMORY

Deallocates the memory at the address sppecified. The addres must have been obtained by a previous ALLOC_MEMORY function, otherwise the result is undefined.

 

FREEFILE

Function. Returns the lower free channel number

A=FREEFILE

 

a b c d e f G h i j k l m n o p q r s t u v w x y z

 

GET var$

GET #channel [, n]

 

Statement. In the first case, GET is used to retrieve a character typed on the keyboard, and place it in variable "var$". The program execution is suspended until a key is pressed on the keyboard, after which the execution resumes with the next line of code. In the second case, GET is used to retrieve a specified record number "n" from the open random access input/output channel "channel". If "n" is not defined, then the next record is retrieved (see OPEN).
GET K$: PRINT "The key pressed was "; K$
GET #1

 

GET (x1,y1)-(x2,y2),str$

Store area of screen specified by co-ordinates x1,y1 and x2,y2 into string srt$.

See PUT to place back on screen.

GET (10,10)-(100,100),a$                                                                                                                                                                                                                           Full syntax needed

 

GOSUB label  (GO SUB)

Statement. Branches to a subroutine defined by "label", where "label" is a label name or line number to branch to. GOSUB causes execution to branch to the subroutine, execute the lines contained within that subroutine, and then via a RETURN statement, continue execution of code after the GOSUB (see RETURN).
GOSUB GetUserInput
GOSUB 1110

 

GOTO label  (GO TO)

Statement. Branches to "label", where "label" is a label name or line number, continuing the execution of statements at that point.
GOTO EndOfProgram

 

GRAPHICS [CLS|PAPER|PEN]

Statement. Enables the use of the CLS, PAPER, and PEN statements in the graphics modes (see MODE).
COLOR ,0: GRAPHICS CLS

 

Where CLS will clear whole screen GRAPHICS CLS clears only to current position.

 

GRAPHICS SCROLL  xx, yy, xx2, yy2, -z, n                     (v0.11.0)                                                                                              Exact Syntax usage unknown

 

a b c d e f g H i j k l m n o p q r s t u v w x y z

 

HEX$ (n)

Function. Returns a string representing the hexdecimal value of the number "n", which may be positive or negative.
PRINT HEX$ (10);" is the hexdecimal value = 10."

 

a b c d e f g h I j k l m n o p q r s t u v w x y z

 

IF exp1 THEN exp2 [ELSE exp3]

Statement. The IF-THEN-ELSE construct is used to form logic based interactive branching. "exp1" is either a logic or arithmetic expression test, which if it evaluates to TRUE (-1), causes the execution of the THEN expression "exp2". Otherwise execution continues with the next line, or if the ELSE expression "exp3" is defined, then it is executed instead. Expressions "exp2" and "exp3" may be other statements or functional expressions.
IF A$ = "K" THEN GOTO 40
IF N = 10 THEN V$ = HEX$(N) ELSE GOSUB NewItem
IF y >= 15 THEN Y = 15

 

IF_DEBUG

IF_DEBUG n If debug level is greater or equal than n the rest of the line is executed, otherwise is ignored.
See the --debug command line option and the DebugLevel system var.

 

INK n[,n]

INK n Same as PEN n
INK n, color [, second] Define the ink number n as the color, from the table of Amstrad CPC compatible colors.

The optional second parameter is accepted for compatibility with the CPC but is ignored.
PRINT modifier: INK n Same as standalone instruction, but the effects remains only until the actual PRINT ends.

 

INK n, r, g, b

Define the ink number n as the color from the rgb components, r, g and b between 0 and 255. (also PRINT modifier)

 

INKEY

Should returns code of key being pressed, does not wait for input.   

Does NOT Appear to Work V0.10.0(WIN)

 

INKEY$

Function. Returns the first value from the keyboard buffer as a single character string. Does not pause for input.

 

Note: INKEY$ will report on alpha keys and symbols on keyboard as ASSCI chars but special keys can also be read using INKEY$ they are:

 

ESC          =                ASC(INKEY$)=27                  ; use ASC function to read

TAB          =                ASC(INKEY$)=9                     ; use ASC function to read

BACKSPACE =       ASC(INKEY$)=8                     ;                                

CTRL + ALPHA      ASC(INKEY$)= Number of letter in alphabet (eg:A=1, C=3)

CTRL+BREAK        ASC(INKEY$)= 3                    ; Equiv CTRL+C

HOME, END, PAGEUP, PAGEDOWN             ; Guess

UP, DOWN,LEFt & RIGHT                                   ; INKEY$ values for arrow keys

F1..F12                                                                         ; Function Keys

INSERT, DELETE                                                        ; those Keys

 

CLICK, RELEASE                                                        ; reads LEFT MOUSE BUTTON

SCLICK,SRELEASE                                                    ; reads RIGHT MOUSE BUTTON

 

                                                     
K$ = INKEY$: IF K$ = "Q" OR K$=”END” THEN GOTO EndOfProgram

 

 

 

INPUT #channel, var1 [, var2...]

Statement. Gets a value or string from the open sequential input/output channel "channel" and assigns the value to the variable var1 (, var2, etc). The variables may be any number of string or numeric variables. If the data being read does not match up with the variable types used, an error will occur.
INPUT #1, NAM$, AGE, DOB$
PRINT " NAME : "; NAM$
PRINT " AGE : "; AGE
PRINT "DATE OF BIRTH : "; DOB$

 

INPUT ["prompt";] var1 [, var2...]

Statement. Pauses program execution to get input from the keyboard. If used, "prompt" is a quoted string that replaces the standard INPUT prompt character "?", with the string defined by "prompt". The variables "var1", "var2", etc are used to store the resulting keyboard input, which is terminated by a carriage return. These variables may be of string or numeric type. The data input by the user must match the types of the variables, otherwise an error will occur. Should multiple variables need to be entered, the user must separate the data entered by commas.
INPUT K$
INPUT "Your name : "; NAM$
INPUT "Please enter your name and age (name, age) : "; NAM$, AGE

 

INPUT$ (n)

Function. Pauses and waits for keyboard input, until the number of characters input equals the number "n". INPUT$ then returns those characters as a string, and continues with the execution of the Blassic program. INPUT$ does not display a prompt.
K$ = INPUT$ (3): PRINT "Characters : "; K$

 

INSTR ([n,] str1$, str2$)

Function. Returns a numeric value indicating the position of the first instance string "str2$" is found within string "str1$", where "n" is a numeric value indicating the starting position within "str1$" where the search is to begin. If "n" is ommitted, then the searching begins with the first character of "str1$". If "str1$" is null, then INSTR returns "0". If "str2$" is null, then INSTR returns the "1".
PRINT INSTR ("HELLO", "L")
L$ = "HELLO": P = INSTR (3, L$, "O"): PRINT "Position = "; P

 

INT (n)

Function. Returns the integer value of the decimal number "n".
AGE = INT (20.75): PRINT AGE

 

INVERSE  [n]

Print modifier as Spectrum, cause text ink and paper to be inversed when printed.

 

a b c d e f g h i j K l m n o p q r s t u v w x y z

 

KILL path$

Statement. Deletes the file specified by "path$". If "path$" does not specify an explicit or relative path to the file, then the current defined path is used (see CHDIR).
KILL "..\test.txt"

 

a b c d e f g h i j k L m n o p q r s t u v w x y z

 

LABEL str$

Defines a label "str$" in the program. For statements that normally use a line number as parameter, such as GOTO, a defined label name can be substituted for the line number. LABEL must be the first instruction in the line, otherwise it is ignored.
LABEL EndOfProgram

           

Label can now also be used as a function to return line number that the label is defined in:

EG: IF ERL=…

 

LCASE$

Same as LOWER$

 

LEFT$ (str$, n)

Function. Returns the left-most number "n" of characters of string "str$" as a string.
K$ = "HELLO": PRINT LEFT$ (K$, 3)

 

LEN (str$)

Function. Returns the length of string "str$", as a numeric value.
A$ = "HELLO": PRINT "The string "; A$; " contains "; LEN (A$); " characters."

 

LET var = n

Statement. Assigns the value "n" to the variable "var". This statement is mainly included for compatibility reasons, as in most versions of BASIC (including Blassic) the equals (=) sign is sufficient to make the assignment.
LET A$ = "TEST"
LET X = 10

 

LINE  (x1,y2)-(x2,y2),[color][,bf]

Draw a line from x1,y1 to x2,y2, optional set color to use.

If bf is set then draw a filled box = see sample program “testrect.bas”

 

LINE INPUT [#channel,] str$

Statement. If the open input/output channel "channel" is defined, then LINE INPUT retrieves a line of string data "str$" from the input/output channel, in which the line of data can contain any character, including commas (or other defined delimiters). If "channel" is omitted or undefined, then LINE INPUT pauses the program execution to get a line of input data "str$" from the keyboard, which can contain any character, including commas.
LINE INPUT #1, L$
PRINT "Data : ";: LINE INPUT L$

 

LIST [n1][-][n2]

Command. List the currently loaded program in memory. If neither "n1" or "n2" are defined, then the entire program is listed. If "n1" is defined, and proceeded with a "-", then all lines from line "n1" to the end of the program are listed. If "n2" is defined, and preceeded with a "-", then all lines from the beginning of the program to "n2" are listed. If both "n1" and "n2" are defined in such a way as to present a range of line numbers, then all lines between those lines are listed.
LIST
LIST 20-
LIST -50
LIST 20-50

 

LLIST

Same as LIST but the default channel is directed to the printer output.

 

LOAD file$

LOAD file$, var$

LOAD file$, address [, size]

Command. Loads a Blassic program "file$". If the program is not found, then "file$" with ".blc" and ".bas" concatenated onto "file$" are tried. If string var$ is used, then the program is loaded into the string variable. If address and/or size are defined, then the file is loaded in the address of memory specified. If size is used, only that many bytes are loaded, otherwise the entire file is loaded.
LOAD "test"
LOAD "test.bas", V$
LOAD "test.bas", 100, 1000

 

LOC

Function. Returns the current position in the channel number specified, 0 if no read or write operation has been done yet, that must be a file opened in random mode.

 

LOCAL var

Statement. Defines a variable "var" as being "local" to the subroutine or function in which it is defined. When this is done, the variable acts independently of other instances defined outside of the subroutine or function, such that any changes made to the variable are not reflected by other outside instances of that variable.
10 B = 5: PRINT B
20 GOSUB 50: PRINT B
30 END
40 REM START OF SUBROUTINE
50 LOCAL B
60 B = 200
70 PRINT B
80 RETURN

 

LOCATE v, h

Statement. Moves the text cursor to the location specified by the values "v" and "h" to denote the vertical and horizontal positions accordingly.
CLS: LOCATE 5, 10: PRINT "Here!"

 

LOF #n

Function. Returns the length of the file associated with the channel number specified.

 

LOG (n)

Function. Returns the natural logarithm (base e) of "n", where "n" is any number greater than zero (0). If "n" is defined as zero, then LOG returns "-inf" (infinity).
PRINT "The log of 2 is "; LOG(2)

 

LOG10 (n)

Function. Returns the base 10 logarithm of "n", where "n" is any number greater than zero (0). If "n" is defined as zero, then LOG10 returns "-inf" (infinity).
PRINT "The log10 of 2 is "; LOG10(2)

 

 

 

LOWER$ (str$)

Function. Returns the lowercase converted version of the string "str$".
A$ = "HELLO": PRINT LOWER$ (A$)

 

LPRINT

Same as PRINT but the default channel is directed to the printer output

 

LSET var1$ = var2$

Statement. Moves data into a random-access file buffer, where "var1$" is the name of a string variable defined with a FIELD statement, and "var2$" is a string variable to be placed into that field. The data placed in the field is left-justified according to the space in the field. If "var2$" is larger than the field, then the data is truncated on the right. Please note that this statement works on strings only. Numeric data needs to be converted into a string using the functions MKD$, MKI$, MKL$, or MKS$.
B$ = "TEST": LSET F$ = B$

 

LTRIM$ (str$)

Function. Removes leading left-hand spaces from the string "str$", and returns the modified string.
PRINT LTRIM$ (" HELLO "); "GOODBYE"

 

a b c d e f g h i j k l M n o p q r s t u v w x y z

 

MASK [n1 [,n2]]

Statement. Sets the graphics bitmask mode. If "n1" is set, the mode affects all graphics operations. If "n2" is set, the mode only affects the first used graphics statement. The modes are as follows:

Mode

Description

0

Copy

1

XOR

2

AND

3

OR

4

Invert


MASK 1, 0

 

MAT

                                                Syntax unknown – reserved keyword unimplemented?

            (Matrix operations on  data)

 

MAX (var1, var2 [,...])

Function. Returns the value which is highest in the list of numeric variables passed to MAX.

PRINT "The maximum is "; MAX (10, 20, 30)

 

MID$ (str$, n1, n2)

Function. Returns a string of characters from the string "var$", beginning at position number "n1" of the string, for a length of "n2".
K$ = "HELLO": PRINT MID$ (K$, 3, 2)

 

MIN (var1, var2 [,...])

Function. Returns the value which is lowest in the list of numeric variables passed to MIN.
PRINT "The minimum is "; MIN (10, 20, 30)

 

MKD$ (n)

Function. Converts the double-precision number "n" into an 8-byte string so it can later be retrieved from a random-access file as a numeric value.
V$ = MKD$ (12.5)

 

MKDIR path$

Statement. Creates a sub-directory "path$" in the current directory (see CHDIR).
MKDIR "temp"

 

MKDMBF$

As MKD$(n) but 8bit floating point format

 

MKI$ (n)

Function. Converts the integer number "n" into an 2-byte string so it can later be retrieved from a random-access file as a numeric value.
V$ = MKI$ (12)

 

MKL$ (n)

Function. Converts the long-integer number "n" into an 4-byte string so it can later be retrieved from a random-access file as a numeric value.
V$ = MKL$ (1234)

 

 

MKS$ (n)

Function. Converts the single-precision number "n" into an 4-byte string so it can later be retrieved from a random-access file as a numeric value.
V$ = MKS$ (12.5)

 

MKSMBF$

As above but 8 bit floating point.

 

MOD

Mathematical Operation. Returns the modulo (remainder) value computed between two numbers.
A = 5 MOD 3: PRINT A

 

MODE n

MODE h, w

MODE h, w, d

Statement. Initializes and creates a graphics mode window of size type "n". When using the second notation, MODE allows the user to create a graphics mode window of arbitrary height ("h") and width ("w"). When using the third notation, setting "d" to "1" causes the y coordinates to be reversed (ie, coordinates decrease going down). Omitting "d" or setting it to "0" returns it to normal operation.

 

Note if blassic is started with –d (disconnect from console) and in graphics mode issuing mode 0 will cause blassic to exit abruptly. (WINDOWS)

**********************************************************************BUG ALERT

 

Valid values for "n" include:

 

Number

Description

0

Text Mode

1

320 x 200

2

640 x 200

5

320 x 200

10

640 x 480

11

800 x 600


MODE 1: REM Change to 320x200 mode
MODE 1024, 768

 

MODE str$

Statement. Initializes and creates a graphics mode based on the mode description string "str$".  Sets resolution of window and character set in use.

 

The following modes are available for use:

 

Mode

Description

Inverted Y Axis?

spectrum

256 x 176

Yes

cpc2

640 x 400

Yes

cpc1

320 x 200

Yes

cpc0

 

Yes

pcw

 

 

pcw2

 

 


MODE "cpc2"

 

Does zoomx, zoomy work, mentioned as update in .0.6.0 (old) but can’t figure syntax, would be useful for spectrum. Are further modes defined ?

 

MOVE x, y

MOVER x, y

Statement. Moves the position of the virtual graphics cursor to the absolute position "x, y", for subsequent graphics operations such as DRAW (see DRAW). MOVER moves the graphics cursor relative to the current position.
COLOR 1: MOVE 50,50: DRAW 100,100


a b c d e f g h i j k l m N o p q r s t u v w x y z

 

NAME file1$ AS file2$

Statement. Renames a file in the current directory from filename "file1$" to filename "file2$".
NAME "TEST.BAS" AS "NEWTEST.BAS"

 

NEW

Statement. Clears program from memory.
NEW

 

NEXT [var]

Statement. Terminates a FOR-NEXT loop, where "var" is the numeric loop variable. Program execution continues either with the statement following the FOR, or the with the next statement after the NEXT, depending on the value of the counter specified in the FOR (see FOR). Var may omitted in which case last defined next is looped.
FOR T = 1 TO 10: NEXT T

 

NOT

Logical Operation. Returns the bitwise-NOT value computed between two numbers.
A = 5 NOT 3: PRINT A

 

a b c d e f g h i j k l m n O p q r s t u v w x y z

 

OCT$ (n)

Function. Returns the octal value (in string form) of the number "n".
OV$ = OCT$ (24): PRINT "The octal value of 24 is ";OV$

 

ON BREAK CONT

ON BREAK GOSUB label

ON BREAK STOP

Statement. ON BREAK takes three forms, each form defining a different method of handling what happens if the user of the Blassic program presses CTRL-C. The first form cancels the effect of CTRL-C stopping the program. The second form causes the program to jump to the subroutine specified "label" (which may be a label name or line number - see GOSUB and LABEL). The third form disables the effects of any prior ON BREAK CONT and ON BREAK GOSUB usage, and allows the normal action of CTRL-C to interrupt the running program.
ON BREAK CONT
ON BREAK GOSUB BRK_HANDLER
ON BREAK STOP

 

ON ERROR GOTO label

Statement. ON ERROR GOTO causes the running Blassic program to jump to the specified "label" (which may be a label name or line number - see GOTO and LABEL) Also see RESUME, ERR, and ERL.
ON ERROR GOTO ERR_HANDLER

 

ON n [GOTO|GOSUB] label1, ..., labelX

Statement. Causes the running Blassic program to jump to a "label" in the program or a "label" of a subroutine (see GOTO, GOSUB, and LABEL), depending on the numeric value "n". For example, if "n" equals "2", then the second label would be jumped to.
T = 3: ON T GOTO 100, 200, 300
FOR T = 1 TO 3: ON T GOSUB 100, 200, 300: NEXT T

 

OPEN file$ FOR mode AS #channel

Statement. Opens a file "file$", where "file$" is the name of a file and/or path to a file for processing. The file is opened for a particular "mode", which may be INPUT, OUTPUT, APPEND, or RANDOM, and is assigned an available input/output channel "channel", for subsequent file operations.
OPEN "test.txt" FOR INPUT AS #1

 

OPTION BASE                                                                                          (v0.11.0)

                                                                                                            Syntax required

 

OR

Logical Operation. Returns the bitwise-OR value computed between two numbers.
A = 5 OR 3: PRINT A

 

ORIGIN x,y

Set graphic point of origin (0,0) to true position x,y

 

OSFAMILY$

Function. Returns a string representing the type of Operating System Family the OS that the Blassic program is running on.
PRINT "The OS Family is "; OSFAMILY$

 

OSNAME$

Function. Returns a string representing the name of the Operating System that the Blassic program is running on.
PRINT "The OS Name is "; OSNAME$

 

OUTPUT

Not documented yet.

a b c d e f g h i j k l m n o P q r s t u v w x y z

 

PAINT (x,y)[,col][,bor]

Fill area enclosed with border bor color (or col if not defined) with the color col.

PAINT (100,100),5,0

 

 

PAPER n

Statement. Sets the color of the current background to color number "n".

Possible color numbers are:

 

Number

Description

Number

Description

0

Black

8

Dk Grey *

1

Dk Blue

9

Lt Blue *

2

Dk Green

10

Lt Green *

3

Dk Cyan

11

Lt Cyan *

4

Red

12

Lt Red *

5

Purple

13

lt Purple *

6

Brown

14

Yellow *

7

Lt Grey

15

White *


* NOTE: These color values are only valid in the graphics modes (see MODE).
PAPER 5: REM Change to purple

 

PAUSE n

Statement. Pauses the running Blassic program for "n" number of milliseconds. Execution then continues with the next line after the PAUSE.
PAUSE 1000: REM WAIT ONE SECOND

 

PEEK (n)

PEEK16 (n)

PEEK32 (n)

Function. PEEK returns a single-byte value of data located at the address number "n" (see SYSVARPTR). The variants of this command, PEEK16 and PEEK32, return 2-byte (integer) and 4-byte (long integer) values respectively.
V = PEEK (SYSVARPTR)

 

PEN n1 [,n2 [, n3]]

Statement. In the simplest form, PEN allows the program to change the current forground color of printed text to color number "n".

Possible color numbers are:

 

Number

Description

Number

Description

0

Black

8

Dk Grey

1

Dk Blue

9

Lt Blue

2

Dk Green

10

Lt Green

3

Dk Cyan

11

Lt Cyan

4

Red

12

Lt Red

5

Purple

13

lt Purple

6

Brown

14

Yellow

7

Lt Grey

15

White


In this usage, PEN performs much the same as the COLOR statement. PEN does, however, have more advanced modes, which allow for a much greater control of the way text output is displayed in the graphics modes (the advanced modes of PEN only work in the graphic modes, and will cause an error in the text mode). These modes work in the following manner:

PEN n1, n2 [, n3]


Parameter "n2" sets the background draw mode. When "n2" is set to "0", PEN operates in "normal" mode, in which the background is considered "opaque", and any character printed at the location replaces the character currently at that location (see LOCATE). When "n2" is set to "1", PEN operates in "transparent" mode, in which the background is considered transparent, and any character printed at the location will "blend" together (which can allow for multiple effects - play with it!).

Parameter "n3" sets the write mode. The write modes are as follows:

 

Mode

Description

0

Copy

1

XOR

2

AND

3

OR

4

Invert


The exact behavior is dependent on the graphics mode used (see MODE). Using the XOR mode with PEN 15 (ie, PEN 15,,1), as used in the sample program "graph.bas", is the most useful form, for the moment.
PEN 1
PEN 1, 1
PEN 15, 1, 1

 

PI

Function. Returns a single-precision number which represents of PI (π).
PRINT "The value of PI is "; PI

 

PLEASE

Statement. A debugging tool which causes the currently running Blassic program to print the statement "Programmer is too polite in X", where "X" is the line number of the PLEASE statement. When a key is pressed, then execution continues with the next line (ok, I know that explanation is pretty contrived, but what the heck other use can you think for it?)...
PLEASE

 

PLOT x, y

PLOTR x, y

PLOT [TO] x, xx TO yy                   

Statement. Plots a pixel in the current PEN color at the absolute position "x, y". The variant PLOTR plots the pixel relative to the current position.
COLOR 2: PLOT 50, 50

 

NOTE: Extended sysntax as Apple II also available;

 

 PLOT [TO] x, xx TO yy                                                  HELP Exact Syntax and Params Unknown

 

POKE address, n

POKE16 address, n

POKE32 address, n

Statement. POKE places the single-byte value "n" (0-255) into the address location "address". The variants of this command, POKE16 and POKE32, places return 2-byte (integer) and 4-byte (long integer) values at the address location "address" respectively. See SYSVARPTR.
POKE X, 15

 

POP

Statement. Causes the most recent return address from a prior GOSUB to be deleted from the top of the return-address stack, to modify program branch. While useful in some extreme cases, this practice is considered poor programming and should be avoided when possible (see GOSUB and RETURN).
POP

 

POPEN str$ FOR mode AS #channel

Statement. Opens a piped command line "str$", where "str$" is a command string you want to pipe data through, processing the data prior to input or output to the open input/output channel "channel". The pipe is opened for a particular "mode", which may be INPUT, OUTPUT, APPEND, or RANDOM.
POPEN "grep ""test"" > test.txt" FOR OUTPUT AS #1

 

Popen is now bi-directional allowing the capture of errors. Unfinished extension – may not function as expected.

 

POS

Function. POS (#channel) return the horizontal position of the cursors in that channel. Only screen channels are allowed.

 

PRINT [#channel,] var

Statement. Prints the variable "var" to the current graphics or text window. If the open input/output channel "channel" is defined (and opened for OUTPUT or APPEND - see OPEN), then the variable "var" is written to the file.
PRINT "Hello there..."
INPUT NM$: PRINT "Hello, "; NM$
PRINT #1, A$

NOTE: Print may be substituted with ‘?’

IE: ? “Hello” is the same as PRINT “Hello”

 

PRINT AT x, y, var

Statement. Prints the variable "var" to the current graphics or text window, at the position indicated by "x" and "y" (see LOCATE).
PRINT AT 10, 5, "Hello there..."

 

 

 

PRINT USING [#channel,] f$; var

Statement. Prints the variable "var" to the current graphics or text window, formatted using the special formatting string "f$". If the open sequential input/output channel "channel" is defined (and opened for OUTPUT or APPEND - see OPEN), then the variable "var" is written to the file after being formatted.
PRINT USING "This is number ## of ##..."; x; y
PRINT USING #1, "Code ##"; CD

 

PROGRAMARG$ (n)

Function. PROGRAMARG$ returns the command line parameter value at position number "n", excluding the Blassic command and the program name. If there are insufficient parameters, an empty ("") string is returned. Parameters are passed to a Blassic program when the program is run with the Blassic command, as follows:

> blassic program.bas arg1 arg2 [etc]

PRINT "The first argument is "; PROGRAMARG$(0)

 

PROGRAMARG$ arg1$ [, arg2$...]

Command. Establishes the return values of the PROGRAMARG$ function to the args specified. Useful when debugging.
PROGRAMARG$ test, 5

 

PROGRAMPTR

Function. Returns the address of the program memory area, or "0" if there is no program loaded. See the autoview.bas and automod.bas sample programs.
V = PROGRAMPTR

 

PULL

Drops the las element of the REPEAT / UNTIL stack.

PULL FOR

Drops the las element of the FOR / NEXT stack.

PULL GOSUB

Same as POP.

PULL REPEAT

Same as PULL.

PULL WHILE

Drops the las element of the WHILE / WEND stack.

 

 

PUT #channel [,n]

Statement. Writes a record from a random access buffer to a file, where "channel" is an open random access input/output channel, and "n" is the record number to be written to. If "n" is not defined, then the record goes into the next available record (see OPEN).
PUT #1, 5

 

PUT (x,y),str$

Put contents of str$ onto graphics screen at location x,y. A$ is normally an area of screen previously grabbed using GET.                                                                       

PUT (20,20),a$

 

a b c d e f g h i j k l m n o p q R s t u v w x y z

 

RANDOMIZE n

Statement. Reseeds the random number generator with a number "n".
RANDOMIZE TIME

 

RAD

Set trigonometric mode to radians.

 

RANDOM

Not documented yet.

 

READ [#channel,] var1 [, var2...]

Statement. Reads a value or values (var1, etc.) from a defined DATA statement (see DATA). If input/output channel "channel" is defined, then READ reads a data element from the open input/output channel "channel" (see OPEN).
DATA JOHN DOE, 23: READ NAM$, AGE

REAL

See DEF REAL.

 

REGEXP_INSTR

Function: REGEXP_INSTR ( [ pos , ] searched$, regexp$ [ , flags] ) Returns the position of the first match of the regexp$ regular expression in searched$, or 0 if no match. If pos is specified the regexp matching begins at that position. For the values of the flag parameter see REGEXP_REPLACE$.

REGEXP_REPLACE$

 

Function: REGEXP_REPLACE$ ( [ pos, ] searched$, regexp$, rep [, flags] ) Returns the string searched$ with the matches of the regular expression regexp$ replaced by the rep parameter, that can be a string or a FN. In the former case, the $n contained in the string are replaced by the sub expressions matched, in the later the FN function is called with the sub expressions as arguments. The bits on the flag affect the result in the following mode: bit 0 sets no case mode, bit 1 set no begin mode (the string is treated as no located as the begin in a line), bit 2 set no end mode (the string is treated as no located at the end of a line), bit 3 sets the newline mode (the 'any character' wildcards not match a newline character) and the other bits are reserved for future use, must be 0. If pos is specified the regexp matching begins at that position.

 READ #1, NAM$, AGE: REM READ THE NAME AND AGE

 

REM comments ( alt ‘ comments )

Statement. Defines a comment in the code. Characters after the REM statement are ignored by the Blassic interpreter.
REM This is a comment...

 ‘ this is a comment

 

RENUM sline [, snum [, inc]][,stop]

Command. Renumbers the lines of the currently loaded program in the Blassic environment, starting with line "sline", with the renumbering beginning with the line number "snum", and incrementing by "inc" lines. If no parameters are passed to RENUM, then the default is "10, 10, 10".
RENUM 10, 100, 5

‘stop’ - stop renumbering at line ..

 

REPEAT

Statement. Begins a REPEAT-UNTIL loop structure (see UNTIL).
REPEAT
   K$ = INKEY$
UNTIL K$ = "Q"

 

RESTORE [label]

Statement. Restores the DATA read pointer (see DATA and READ) to the point represented by the label "label", where "label" is a line number or label name (see LABEL). If "label" is not defined, then the read pointer is moved to the beginning of the first DATA statement.
RESTORE 100

 

 

RESUME [NEXT | label]

In an ON ERROR GOTO routine, returns to the statement that produced the error, to the next statement, or to the position specified by the label "label", which can be a line number or label name.
RESUME NEXT

 

RETURN [n]

Statement. Returns and continues execution at the line after the last GOSUB statement or to line specified. (see GOSUB).
RETURN

RETURN 10

 

RIGHT$ (var$, n)

Function. Returns the right-most number of "n" characters of string "var$" as a string.

K$ = "HELLO": PRINT RIGHT$ (K$, 3)

 

RINSTR

Function. Like INSTR but from end ot string to beginning.

 

RMDIR path$

 

Statement. Removes the sub-directory named "path$" in the current directory (see CHDIR and MKDIR).
RMDIR "temp"

 

RND (n)

Function. Returns a random single-precision value between 0 and 1.
PRINT "Random roll from 1 to 6 : "; INT (RND * 6) + 1

 

ROUND (n,p)

 Returns rounded integer of n to p places (2 default)

PRINT ROUND(10.77) will output 11

 

<<BUG>>NOTE: If whole number passed you may get errors at around 10 decimal places.

Try PRINT ROUND(10,11) and you get 10.00000000001

 

 

RSET var$ = str$

Statement. Moves data into a random-access file buffer, where "var$" is the name of a string variable defined with a FIELD statement, and "str$" is a string variable to be placed into that field. The data placed in the field is right-justified according to the space in the field. If "str$" is larger than the field, then the date is truncated on the left. Please note that this statement works on strings only. Numeric data needs to be converted into a string using MKD$, MKI$, MKL$, or MKS$.

B$ = "TEST": RSET F$ = B$

 

 

 

RTRIM$ (str$)

Function. Removes trailing right-hand spaces from the string "str$", and returns the modified string.

PRINT RTRIM$ (" HELLO "); "GOODBYE"

 

RUN [n]

Command. Runs the currently loaded Blassic program.
RUN

If n is specified start program from line n

RUN 10

 

a b c d e f g h i j k l m n o p q r S t u v w x y z

 

SAVE file$

SAVE file$, A

Command. The first defined style of the command saves a loaded Blassic program as "file$" in the current directory in the Blassic binary format. The second style of the command saves the program in text format. Filename extensions are not added, but it is reccommended that ".blc" is used for the Blassic binary format, and ".bas" for text format.
SAVE "test.blc"
SAVE "test.bas", A

 

SAVE file$, B, var$

SAVE file$, B, address, size

Statement. The first style of the statement allows the saving of content of the string "var$" in the filename "file$". The second style allows saving bytes into the filename "file$", starting at the "address", for a length of "size".
SAVE "test.txt", B, NM$
SAVE "test.txt", B, 100, 1000

 

SCREEN

                                                Syntax unknown, not implemented, resaved keyword

 

SCREEN$ (x,y)

Returns character at location x,y on screen.

A$=SCREEN$(10,10)

 

 

SCROLL

SCROLL [#window ,] [n]

Scroll the graphics window specified by window, 0 by default, the number of lines specified by n, 1 by default. If n is positive scrolls up and place the cursor at the beginning of the last line, if negative scrolls down and place the cursor at the beginning of the screen.  SCROLL on its own moves screen up 1 line.

 

SET_TITLE

Set the title of the window. In graphics mode, the title of the graphics window is affected. In text mode, in windows the console window is affected, in unix if the terminal type is xterm, aixterm, dtterm, iris-ansi, sun-cmd or hpterm the title of the terminal window is affected, otherwise the instruction has no effect.

 

SGN (n)

Function. Returns back a -1 if the number "n" is negative, 0 if the number is equal to 0, and 1 is the number is positive.
S = SGN (-50): IF S = -1 THEN PRINT "Negative"

 

SHELL str$

Statement. Shells out to the operating system and executes the command line "str$".
SHELL "ls -als" (for *nix)
SHELL "dir *.txt"

 

SIN (n)

Function. Returns the sine value of the number "n".
PRINT SIN (.01)

 

SINH

Function. Returns the hyperbolic sine value or the argument.

 

SOCKET host$, port AS #channel

Statement. Opens a socket and connects it to the "host$" specified using the tcp "port" number, and associates it to an input/output channel "channel".
SOCKET "192.28.45.100", 8080 AS #1

 

SPC (n)

Statement. Used to insert a number of "n" spaces into a PRINT statement (see PRINT).
PRINT SPC (10); "Indented 10 spaces..."

 

SPACE$ (n)

Function. Returns a number of "n" spaces as a string.
SP$ = SPACE$ (10): PRINT SP$; "Indented 10 spaces..."

 

SQR (n)

Function. Returns the square root value of the number "n".
PRINT "The square root of four is : "; SQR (4)

 

STOP

Statement. Causes the currently running Blassic program to stop execution.
STOP

 

STR

See DEF STR.

 

STR$ (n)

Function. Returns back the string representation of the number "n".
N = 50: PRINT STR$ (N)

 

STRING$ (n, char$)

Function. Returns back a string composed of the single character string value "char$", repeated "n" number of times.
PRINT STRING (10, "X")

 

SWAP var1, var2

Statement. Swaps the values of the variables "var1" and "var2", which may be string or numeric. The variables must have matching types, or an error will occur.
A = 1: B = 2: SWAP A, B: PRINT A, B

 

SYMBOL n, byte0, byte1, ..., byte7

Statement. Allows for the redefining of a graphics mode ASCII character symbol. Eight bytes are passed to SYMBOL to redefine the character number "n". The bits that make up each byte determine how the symbol will appear when printed.
SYMBOL 250, 128, 192, 224, 240, 248, 252, 254, 255: REM Redefine symbol 250 to be a triangle shape

SYMBOL AFTER

SYMBOL AFTER n Set the number of permissible user defined characters. Characteres with values from n to 255 become definable. With 0 all chars are definables, with 256 none. All characters are reset to their default values.

 

Also to allow change from normal char set to CPC or Spectrum

syntax unknown

 

SYNCHRONIZE [n]

Statement. When using a graphics mode, Blassic writes any changes to the window to both the graphics window as well as into a bitmap of the same size as the window. This is so that the system can redraw the window as it needs to (such as when a window is overlayed, then uncovered). SYNCHRONIZE allows the program to determine when to write to the bitmap, and when to update the graphics window as needed by the program, rather than by the system. When a "1" is passed to SYNCHRONIZE, any graphics commands only update the bitmap, and not the actual window. Then, when the SYNCHRONIZE statement is used without a parameter, the bitmap is copied into the window, making the changes visible. This process can be repeated as necessary, allowing for fluid motion with little flicker. Passing a "0" to SYNCHRONIZE will return the behavior to normal, copying changes to both the window and the off-screen bitmap buffer.

Here is an example of this method:

x = 160: y=100: dx = 5
Mode 1
While Inkey$ = ""
   x = x + dx
   If x < 0 or x > 320 Then dx = -dx
   Synchronize 1
   Move x-20, y-20
   Pen 4: Draw x+20, y-20: Draw x+20, y+20: Draw x-20, y+20: Draw x-20, y-20
   Pause 1
   Synchronize
   Pen 15: Draw x+20, y-20: Draw x+20, y+20: Draw x-20, y+20: Draw x-20, y-20
Wend
Synchronize: Mode 0

 

SYSTEM

Statement. Quits the running Blassic program and returns to the operating system.
SYSTEM

 

SYSVARPTR

Function. Returns the address of the system variable memory area. For information on the system variables refer to the sysvar.h file in the Blassic sources.
AD = SYSVARPTR

 

a b c d e f g h i j k l m n o p q r s T u v w x y z

 

TAB (n)

Statement. Used to tab "n" number of spaces over in a PRINT statement (see PRINT).
PRINT TAB (10); "Tabbed over 10 spaces..."

 

TAG [#stream]

Redirects text sent to the given stream to the graphics cursor.

                                                                                                                                                                                    , CPC Syntax

TAGOFF

Cancels TAG# previously set.

 

TAN (n)

Function. Returns the tangent value of the number "n".
PRINT TAN (.01)

 

TANH

Not documented yet.

 

TEST

Function. TEST (x, y) moves the graphic cursor to x, y and returns the ink number corresponding to the color of that point.

 

TESTR

Function. Same as TEST but the cursor movement is relative to the current position.

 

THEN

See IF (IF exp THEN statement)

 

TIME

Function. Returns a long integer value representing the current time.
T = TIME: PRINT "TIME = "; T

 

TIME$

Function. Returns a string containing the current time in the format "hh:mm:ss" (24-hour format).
T$ = TIME$: PRINT "The current time is "; T$

 

TO

Part of FOR .. NEXT  loop contruct.

 

TRIM$ (str$)

Function. Removes leading and trailing spaces from the string "str$", and returns the modified string.
PRINT TRIM$ (" HELLO "); "GOODBYE"

 

TROFF

Command. Turns off the trace utility (see TRON).
TROFF

 

TRON

Command. Turns on the trace utility, which causes the line number to be printed at the current cursor position, inside a pair of brackets, as the Blassic program runs (see TROFF).
TRON

 

a b c d e f g h i j k l m n o p q r s t U v w x y z

 

UCASE$

Same as UPPER$

 

UNTIL exp

Statement. Finishes a REPEAT-UNTIL loop structure, where "exp" is the code to evaluate, which if it evaluates to TRUE (-1), the loop exits and continues with the next statement after the UNTIL (see REPEAT).
REPEAT
   K$ = INKEY$
UNTIL K$ = "Q"

 

UPPER$ (str$)

Function. Returns the uppercase representation of the string "str$" as a string.
A$ = "hello": PRINT UPPER$ (A$)

 

USING          

Formats print output.                                                                       (not yet documented)

PRINT USING

 

USR (lib$, func$ [, param$])

Function. Calls the external function "func$" in the defined library "lib$", returning the return value from the function. Optionally, a parameter "param$" may be passed to the function as well.
N = USR ("./testdl.so", "testfunc", VARPTR ("test"))

 

USR

                                                As in Sinclair Spectrum for UDG (user defined graphics)

Use SYMBOL Instead

   Syntax required

 

a b c d e f g h i j k l m n o p q r s t u V w x y z

 

VAL (var$)

Function. Returns the numeric value of the string "var$". The string must start with a number, otherwise VAL returns "0".
PRINT VAL ("10")

 

VAL$

Function. Returns the value of the string argument evaluated as a Blassic string expression

 

 

 

VARPTR (var)

Function. Returns the address pointer of the first byte of data associated with variable "var", which may be any string or numeric variable.
AP = VARPTR("This is a test")

 

VPOS

Function. VPOS (#chanel) return the vertical position of the cursor in channel. Only screen channels in graphics mode are allowed.

 

a b c d e f g h i j k l m n o p q r s t u v W x y z

 

WEND

Statement. Ends a WHILE-WEND looping structure (see WHILE).
WHILE INKEY$ <> "Q"
   PRINT "PRESS Q TO QUIT..."
WEND

 

WIDTH

WIDTH LPRINT n [, m] Stablishes the width of the printer output, when the width is exceeded a line separator is emitted (see the PrinterLine system variable. A value of 0 means unlimitted width. The value m if specified set the left margin for the printer in chars.

 

WHILE exp

Statement. Begins a WHILE-WEND looping structure (see WEND), where "exp" is the code to evaluate which will continue the execution of the loop so long as the evaluation is TRUE (-1).
WHILE INKEY$ <> "Q"
   PRINT "PRESS Q TO QUIT..."
WEND

 

WINDOW #number, x1, x2, y1, y2

Declares text  windows (bounded areas). As Amstrad CPC basic.

x1,x2,y1,y2 are the size and location of the window on screen.

#number is for redirection

for example

 

WINDOW #1,15,80,15,32

PAPER  #1, 4 : CLS #4

PRINT #1,”HELLO WINDOW ONE”

 

NOTE the non standard co-ords used x1 is column start and x2 column end.

y1 is row start and y2 is row end. You can change PAPER and INK of the windows however currently INK #n,col is not supported use PEN #n,col instead.

 

<<BUG>> Looks like the position of the window is not always exactly what you might think further testing needed to determine exactly what is happening here and when

 

WINDOW SWAP  #n1,#n2

Swap contents of windows n1 and n2

 

 

 

 

WRITE #channel, var1 [, var2...]

Statement. Writes a value or values (var1, etc.) to the defined open input/output channel "channel" (see OPEN).
WRITE #1, NAM$, AGE: REM WRITE THE NAME AND AGE

 

a b c d e f g h i j k l m n o p q r s t u v w X y z

 

XMOUSE

Function. Returns the x coordinate of the mouse position (only in graphics mode).
X = XMOUSE

 

XPOS

Function. Returns the x coordinate of the graphics cursor.
X = XPOS

 

XOR

Logical Operation. Returns the bitwise-XOR value computed between two numbers.
A = 5 XOR 3: PRINT A

 

XPOS

Function without parameters. Returns the x coordinate of the graphics cursor.

 

a b c d e f g h i j k l m n o p q r s t u v w x Y z

 

YMOUSE

Function. Returns the y coordinate of the mouse position (only in graphics mode).
Y = YMOUSE

 

YPOS

Function. Returns the y coordinate of the graphics cursor.
Y = YPOS

 

a b c d e f g h i j k l m n o p q r s t u v w x y Z

 

ZONE

ZONE value establishes value as the width of the zones used by the, PRINT delimiter. A value of 0 means 8 in the graphics window and that a tab character is used instead of spaces in printer and in text mode.

 

 

ZX_PLOT

Mimics the PLOT instruction of the ZX-81 Basic.

IE: A 4x4 cell of pixels

 

ZX_UNPLOT

Mimics the UNPLOT instruction of the ZX-81 Basic.

 


 


Blassic Character Sets

 

Spectrum Predefined Block Graphics Codes



PreDefined Color Pallete

Number

Description

Number

Description

0

Black

8

Dk Grey

1

Dk Blue

9

Lt Blue

2

Dk Green

10

Lt Green

3

Dk Cyan

11

Lt Cyan

4

Red

12

Lt Red

5

Purple

13

lt Purple

6

Brown

14

Yellow

7

Lt Grey

15

White



Blassic: System variables.

Last revision: 30-jan-2005

The system variables area begins at the position returned by the function SYSVARPTR, and can be accessed with PEEK and POKE.

 

The values of the multibyte variables are stored in Intel format, even if the actual architecture use a different format, to maximize portability.

 

The name given is used in the source code or Blassic, it will not be recognized in a Blassic program.

 

The value of the Writable column is Yes when writing the variable modifies the behavior of Blassic, No indicates that the value written is not used by Blassic, but can alter further readings.

 

Name

Position

Length

Writable

Description

GraphicsWidth

0

2

No

Width of the window in graphics mode.

GraphicsHeight

2

2

No

Height of the window in graphics mode.

NumArgs

4

2

No

Numbers of args passed to the program from the command line (program name excluded).

VersionMajor

6

2

No

First chunk of version number.

VersionMinor

8

2

No

Second chunk of version number.

VersionRelease

10

2

No

Last chunk of version number.

AutoInit

12

4

Yes

Starting number of line used by AUTO by default and when loading text programs without line numbers.

AutoInc

16

4

Yes

Increment of line number used by AUTO by default and when loading text programs without line numbers.

CharGen

20

4

No

Location in memory of the character generator used in graphics mode.

ShellResult

24

1

No

Return value of the last command invoked by the SHELL instruction.

TypeOfVal

25

1

Yes

Type of VAL function: 0 for only numbers, 1 for expressions evaluation.

TypeOfNextCheck

26

1

Yes

Type of NEXT check: 0, all FOR has to be nested; 1, check relaxed.

TypeOfDimCheck

27

1

Yes

Type of DIM check: 0, DIM an array already dimensioned is an error; 1, is accepted.

MaxHistory

28

2

Yes

Maximum size of the history buffer.

Flags1

30

1

Yes

Bit 0: style of LOCATE, 0 Microsoft (row, col), 1 Amstrad CPC (col, row). Default value 0.
Bit 1: TAB style: 0 normal, 1 Spectrum.
Bit 2: THEN omitted, 0 not accepted, 1 accepted.
Bit 3: space before positive number in PRINT, 0 No, 1 Yes.
Bit 4: space before positive number in STR$, 0 No, 1 Yes.
Bit 5: convert Line Feed to Carriage Return in GET and INKEY$, 0 No, 1 Yes.
Bit 6: show additional info on some error conditions.
Bit 7: relaxed goto mode. 0 the line specified must exist, 1 use the next line existent.

PrinterLine

31

1

Yes

Type of line separator in printer output. 0 --> LF only, 1 --> CR + LF, 2 --> CR only. The default value is 1 in Windows and 0 in other systems.

MaxFnLevel

32

4

Yes

Maximum level of nested FN calls.

DebugLevel

36

2

Yes

Current debug level. Used by the IF_DEBUG instruction.

Zone

38

2

Yes

Size of the zone for the , PRINT separator in graphics mode and printer output. Established by a ZONE instruction.

GraphRotate

40

1

Yes

Type of graphics rotation: 0 - no rotation, 1 - 90 degrees, other values undefined.

Flags2

41

1

Yes

Bit 0: GO TO and GO SUB in listings.
Bit 1: value of true: 0 - true is -1, 1 - true is 1
Bit 2: type of Boolean operations: 0 - numeric, 1 - Boolean
Bit 3: take empty lines as comments when loading text programs: 0 - no, 1 - yes
All other bits reserved for future use.

TronChannel

42

2

No

Last channel number used for TRON or TRON LINE.

 

TronFlags

44

1

No

Bit 0: TRON or TRON LINE is active.
Bit 1: TRON LINE is active.
All other bits reserved for future use.

 

 



Blassic Error Codes

 

Blassic error codes may be retrieved in a Blassic program by using the ERR function (the line number the error occurred in may also be retrieved using the ERL function).

 

The following are descriptions for these error codes:

 

Error Number

Error Description

0

No Error

1

Syntax

2

Type Mismatch

3

Gosub Without Return

4

Return Without Gosub

5

Next Without For

6

Not Implemented

7

Divide By Zero

8

Data Exhausted

9

Invalid Command

10

Polite

11

Bad Subscript

12

Out Of Memory

13

Already Dimensioned

14

No Continue

15

File Number

16

File Mode

17

File Already Open

18

File Read

19

File Write

20

Until Without Repeat

21

Wend Without While

22

While Without Wend

23

Blassic Internal Error

24

No Dynamic Library

25

No Dynamic Symbol

26

Cannot Resume

27

No Label

28

Misplaced Local

29

Field Overflow

30

File Not Found

31

Line Exhausted

32

Function Not Defined

33

Incomplete Def

34

Invalid Direct

35

Bad Record

36

Function Call

37

Socket

38

Rename File

39

Operating System

40

Input Past EOF

 



Blassic printing guide.

Last modified: 30-aug-2003.

 

Printer output.

Printer output is buffered until Blassic exits or CLOSE LPRINT is done. Thus the amount of printable data is limited by the available memory.

The type of output is controlled by the environment variable BLASSIC_PRINT_COMMAND. Our value is used as a command that will receive in his standard input the printer output buffered. If is empty, "lp" is used in Unix versions and a raw write to the default printer is done in windows.

Line Width and line separator.

The line width of the printer output is limited to a value definable with the WIDTH LPRINT instruction, inserting a line separator when exceeded. The line separator is controlled with the system variable PrinterLine, and can be a Line Feed (default value in unix versions, a Carriage Return and a Line Feed (default value in Windows) or Carriage Return. If you do not want this insertion of line separator you can do WIDTH LPRINT 0. The count of characters that forms a line is restored when a LPRINT sentence that ends without separator is executed; a line feed or carriage return explicitly printed is not considered as a line end. This can change in future versions of Blassic.

LPRINT and LLIST instructions.

The LPRINT and LLIST instructions are the same as PRINT and LIST, the only difference is the default channel used, that in LPRINT and LLIST is 65535 instead of 0. That channel is directed to the printer output, unless an OPEN, POPEN or SOCKET instruction was used with that number. In that case, when closed will be directed again to the printer output.
You can redirect that channel with an special form of the OPEN instruction: OPEN "filename" AS LPRINT, that is equivalent to open for output in channel 65535.

ZONE in printing.

When ZONE 0 is specified, the , separator of PRINT will emit a tab character, in other case the space until the next zone is filled with space characters.

Printing from windows appears not to function to USB based printers possibly only works with LPT1 printer can someone please confirm.

Last page is not printed.

Blassic does not emit any type of form feed at the end of the job. In unix versions the spooler probably add it, but in windows, using raw output as we do, will not be added, then in page printers the last data remains in the printer memory waiting for more. The next printing job will probably force a form feed, or you may force it using the printer controls, or you can a add the form feed sequence of your printer to the end of the printing (usually 1A hex, 26 dec character).

Postscript printers.

Postscript printers are not directly supported, unless your spooler in Unix converts automatically non-postscripts job. You can, of course, write a Blassic program that writes valid postscript code.

 

ASCII Character Sets                                                 To be completed

 

WINDOWS TEXT CONSOLE , HEX (CP850)

 

20=      21=!    22="    23=#    24=$    25=% 26=&   27='

28=(    29=)    2A=*   2B=+   2C=,    2D=-   2E=.    2F=/

30=0    31=1    32=2    33=3    34=4    35=5    36=6    37=7

38=8    39=9    3A=:    3B=;    3C=<   3D== 3E=>   3F=?

40=@ 41=A   42=B   43=C   44=D   45=E   46=F   47=G

48=H   49=I    4A=J   4B=K 4C=L   4D=M             4E=N 4F=O

50=P   51=Q   52=R   53=S    54=T   55=U   56=V   57=W

58=X   59=Y   5A=Z 5B=[    5C=\    5D=]   5E=^   5F=_

60=`    61=a    62=b    63=c    64=d    65=e    66=f    67=g

68=h    69=i     6A=j    6B=k   6C=l    6D=m 6E=n   6F=o

70=p   71=q    72=r    73=s    74=t    75=u    76=v    77=w

78=x    79=y   7A=z   7B={   7C=|    7D=}   7E=~   7F=⌂

A0=     A1=¡   A2=¢   A3=£   A4=¤   A5=¥   A6=¦    A7=§

A8=¨   A9=©  AA=ª AB=« AC=¬ AD=­ AE=®             AF=¯

B0=°   B1=±   B2=²    B3=³    B4=´    B5=µ   B6=¶   B7=·

B8=¸    B9=¹    BA=º   BB=» BC=¼             BD=½             BE=¾ BF=¿

C0=À C1=Á C2=Â C3=Ã C4=Ä C5=Å C6=Æ             C7=Ç

C8=È   C9=É   CA=Ê CB=Ë CC=Ì   CD=Í   CE=Î   CF=Ï

D0=Ð D1=Ñ D2=Ò D3=Ó D4=Ô D5=Õ D6=Ö D7=×

D8=Ø D9=Ù DA=Ú             DB=Û             DC=Ü             DD=Ý             DE=Þ DF=ß

E0=à    E1=á    E2=â    E3=ã    E4=ä    E5=å    E6=æ   E7=ç

E8=è    E9=é    EA=ê   EB=ë   EC=ì    ED=í   EE=î    EF=ï

F0=ð   F1=ñ   F2=ò   F3=ó   F4=ô   F5=õ   F6=ö   F7=÷

F8=ø   F9=ù   FA=ú FB=û   FC=ü   FD=ý FE=þ   FF=ÿ

 


ALL Reserved Words

In token order; these cannot be used as variable names

Commands

END                 LIST                 LOAD               SAVE               NEW                EXIT

RUN                 PRINT              FOR                 NEXT               TO                   STEP

IF                     THEN               ELSE                TRON               TROFF                         LET     

GOTO               STOP               CONT               CLEAR                         GOSUB             RETURN

POKE               READ               RESTORE         INPUT              LINE                 RANDOMIZE   

PLEASE            DATA               AUTO               DIM                  SYSTEM          ON      

ERROR                         OPEN               CLOSE                         OUTPUT          AS                    LOCATE

CLS                  APPEND           WRITE                         MODE              MOVE              COLOR            

GET                 LABEL             DELIMITER      REPEAT           UNTIL              WHILE            

WEND              PLOT               POPEN                         RESUME          DELETE           LOCAL

RANDOM         PUT                 FIELD               LSET                RSET               SOCKET

DRAW              DEF                  FN                    ERASE                         SWAP              SYMBOL

ZONE               POP                  NAME              KILL                 FILES               PAPER            

PEN                  SHELL              MERGE                        CHDIR              MKDIR                         RMDIR

BREAK             SYNCHRONIZE                         PAUSE                         CHAIN              STR

REAL               ENVIRON         EDIT                DRAWR           PLOTR                         MOVER

POKE16            POKE32            RENUM            CIRCLE                        MASK              WINDOW

GRAPHICS       AFTER                         BEEP                DEFINT            DEFREAL         DEFSNG

DEFDBL           INK                  SET_                TITLE              TAG                 TAGOFF

ORIGIN             DEG                 RAD                 INVERSE          IF_                   DEBUG

LPRINT            LLIST               WIDTH                         BRIGHT           BINARY           DRAWARC

PULL                PAINT              FREE_MEMORY           SCROLL ZX_PLOT

ZX_UNPLOT     OPTION            BASE               MAT                BORDER          SCREEN

 

String functions

MID$                LEFT$              RIGHT$            CHR$               ENVIRON$        STRING$

 OSFAMILY$    HEX$                SPACE$            UPPER$            LOWER$          STR$

OCT$               BIN$                 INKEY$            PROGRAMARG$                       DATE$

TIME$              INPUT$            MKI$                MKS$               MKD$               MKL$

TRIM$              LTRIM$            RTRIM$           OSNAME$        FINDFIRST$     FINDNEXT$

COPYCHR$      STRERR$         DEC$                VAL$                SCREEN$         MKSMBF$

MKDMBF$       REGEXP_REPLACE$                 UCASE$           LCASE$            ASC

LEN                  PEEK                PROGRAMPTR                         RND     INT      SIN       COS

PI         TAN     SQR     ASIN    ACOS   INSTR ATAN   ABS     USR     VAL     EOF

VARPTR          SYSVARPTR    SGN     LOG     LOG10  EXP      TIME    ERR     ERL

CVI      CVS     CVD     CVL     MIN      MAX    CINT    FIX       XMOUSE          YMOUSE

XPOS   YPOS   PEEK16            PEEK32            RINSTR            FIND_FIRST_OF

FIND_LAST_OF            FIND_FIRST_NOT_OF              FIND_LAST_NOT_OF

SINH    COSH   TANH   ASINH ACOSH ATANH ATAN2            TEST   TESTR             POS

VPOS   LOF      FREEFILE         INKEY              ROUND            CVSMBF          CVDMBF

REGEXP_INSTR           ALLOC_MEMORY        LOC

 

Operators with names

NOT     OR       AND     TAB     SPC      AT       XOR     MOD    USING

Operators with signs

<> <= >= =< => ><